$(function(){
    var moive = 'http://47.108.197.28:4000/api/movie/top250';
    var hot = 'http://47.108.197.28:4000/api/movie/inTheaters';
    var show = 'http://47.108.197.28:4000/api/movie/comingSoon';
    $ajax({
        url:moive,
        success:res=>{
            var result = res.res;
            result.slice(0,3).forEach(item=> {
                var {pic,title} = item;
                var template = `
               
               <div> 
               <img src="https://images.weserv.nl/?url=${pic}" alt="">
               <p>${title}</p>
               </div>
               
               
                `
                $(".top").append(template)
            });
        }
    })
    $ajax({
        url:hot,
        success:res=>{
            var result = res.res;
            result.slice(0,3).forEach(item=> {
                var {pic,title} = item;
                var template = `
               
               <div> 
               <img src="https://images.weserv.nl/?url=${pic}" alt="">
               <p>${title}</p>
               </div>
               
               
                `
                $(".hot").append(template)
            });
        }
    })
    $ajax({
        url:show,
        success:res=>{
            var result = res.res;
            result.slice(0,3).forEach(item=> {
                var {pic,title} = item;
                var template = `
               
               <div> 
               <img src="https://images.weserv.nl/?url=${pic}" alt="">
               <p>${title}</p>
               </div>
               
                `
                $(".show").append(template)
            });
        }
    })
})